﻿// Decompiled with JetBrains decompiler
// Type: DnProcessSimulateCommands.InterferenceVolume.CUiIVInterferenceVolumeInitParams
// Assembly: DnProcessSimulateCommands, Version=2402.0.0.890, Culture=neutral, PublicKeyToken=null
// MVID: A885D881-AEDF-447E-852A-6F13102E089C
// Assembly location: C:\Program Files\Tecnomatix_2402\eMPower\DotNetCommands\DnProcessSimulateCommands.dll

using System.Collections.ObjectModel;
using Tecnomatix.Engineering;


namespace DnProcessSimulateCommands.InterferenceVolume;

public class CUiIVInterferenceVolumeInitParams
{
  private TxObjectList m_sweptVolumes;

  public CUiIVInterferenceVolumeInitParams() => this.m_sweptVolumes = new TxObjectList(2);

  public CUiIVInterferenceVolumeInitParams(TxObjectList sweptVolumes)
  {
    this.SweptVolumes = sweptVolumes;
  }

  public TxObjectList SweptVolumes
  {
    get => this.m_sweptVolumes;
    set => this.m_sweptVolumes = this.GetProcessedSVItems(value);
  }

  public virtual void InitFromSelection()
  {
    this.SweptVolumes = this.GetProcessedSVItems(TxApplication.ActiveSelection.GetAllItems());
  }

  protected TxObjectList GetProcessedSVItems(TxObjectList items)
  {
    TxObjectList processedSvItems = (TxObjectList) null;
    if (items != null)
    {
      if (((Collection<ITxObject>) items).Count < 1 || ((Collection<ITxObject>) items).Count > 2)
      {
        processedSvItems = new TxObjectList();
      }
      else
      {
        processedSvItems = new TxTypeFilter(typeof (TxSweptVolume)).Filter(items);
        if (processedSvItems != null && ((Collection<ITxObject>) processedSvItems).Count < ((Collection<ITxObject>) items).Count)
          ((Collection<ITxObject>) processedSvItems).Clear();
      }
    }
    return processedSvItems;
  }
}
